package HomeWork;

public class Work_6 {
    public static void main(String[] args) {
        Doctor jack = new Doctor("jack", 28, "java", "男", 3000);
        Doctor mark = new Doctor("jack", 8, "java", "男", 3000);
        System.out.println(jack.equals(mark));

    }
}
class Doctor{
    //name,age,job,gender,sal
    private String name;
    private int age;
    private String job;
    private String gender;
    private double salary;
    public Doctor(String name,int age,String job,String gender,double salary){
        this.age=age;
        this.job=job;
        this.gender=gender;
        this.name=name;
        this.salary=salary;
    }
    public void setName(String name){
        this.name=name;
    }
    public String getName(){
        return this.name;
    }
    public void setAge(int age){
        this.age=age;
    }
    public int getAge(){
        return this.age;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
    //方法
    public boolean equals(Object obj){
        if(!(obj instanceof Doctor)){
            return false;
        }
        Doctor tem=(Doctor) obj;
        return this.name.equals(tem.getName())&&this.age==tem.getAge()&&this.job.equals(tem.getJob())&&this.gender.equals(tem.getGender())&&this.salary==tem.salary;
    }
}
